<?php


/*
* Copyright (c) 2008-2016 vip.com, All Rights Reserved.
*
* Powered by com.vip.osp.osp-idlc-2.5.11.
*
*/

namespace com\vip\top\carrier\bizservice;

class SubTransportNoResponse {
	
	static $_TSPEC;
	public $tmsResponseHeader = null;
	public $orderSn = null;
	public $mainTransportNo = null;
	public $custCode = null;
	public $warehouse = null;
	public $subTransportNoInfo = null;
	
	public function __construct($vals=null){
		
		if (!isset(self::$_TSPEC)){
			
			self::$_TSPEC = array(
			1 => array(
			'var' => 'tmsResponseHeader'
			),
			2 => array(
			'var' => 'orderSn'
			),
			3 => array(
			'var' => 'mainTransportNo'
			),
			4 => array(
			'var' => 'custCode'
			),
			5 => array(
			'var' => 'warehouse'
			),
			6 => array(
			'var' => 'subTransportNoInfo'
			),
			
			);
			
		}
		
		if (is_array($vals)){
			
			
			if (isset($vals['tmsResponseHeader'])){
				
				$this->tmsResponseHeader = $vals['tmsResponseHeader'];
			}
			
			
			if (isset($vals['orderSn'])){
				
				$this->orderSn = $vals['orderSn'];
			}
			
			
			if (isset($vals['mainTransportNo'])){
				
				$this->mainTransportNo = $vals['mainTransportNo'];
			}
			
			
			if (isset($vals['custCode'])){
				
				$this->custCode = $vals['custCode'];
			}
			
			
			if (isset($vals['warehouse'])){
				
				$this->warehouse = $vals['warehouse'];
			}
			
			
			if (isset($vals['subTransportNoInfo'])){
				
				$this->subTransportNoInfo = $vals['subTransportNoInfo'];
			}
			
			
		}
		
	}
	
	
	public function getName(){
		
		return 'SubTransportNoResponse';
	}
	
	public function read($input){
		
		$input->readStructBegin();
		while(true){
			
			$schemeField = $input->readFieldBegin();
			if ($schemeField == null) break;
			$needSkip = true;
			
			
			if ("tmsResponseHeader" == $schemeField){
				
				$needSkip = false;
				
				$this->tmsResponseHeader = new \com\vip\top\carrier\service\TmsResponseHeader();
				$this->tmsResponseHeader->read($input);
				
			}
			
			
			
			
			if ("orderSn" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->orderSn);
				
			}
			
			
			
			
			if ("mainTransportNo" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->mainTransportNo);
				
			}
			
			
			
			
			if ("custCode" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->custCode);
				
			}
			
			
			
			
			if ("warehouse" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->warehouse);
				
			}
			
			
			
			
			if ("subTransportNoInfo" == $schemeField){
				
				$needSkip = false;
				
				$this->subTransportNoInfo = new \com\vip\top\carrier\bizservice\SubTransportNoInfo();
				$this->subTransportNoInfo->read($input);
				
			}
			
			
			
			if($needSkip){
				
				\Osp\Protocol\ProtocolUtil::skip($input);
			}
			
			$input->readFieldEnd();
		}
		
		$input->readStructEnd();
		
		
		
	}
	
	public function write($output){
		
		$xfer = 0;
		$xfer += $output->writeStructBegin();
		
		$xfer += $output->writeFieldBegin('tmsResponseHeader');
		
		if (!is_object($this->tmsResponseHeader)) {
			
			throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
		}
		
		$xfer += $this->tmsResponseHeader->write($output);
		
		$xfer += $output->writeFieldEnd();
		
		if($this->orderSn !== null) {
			
			$xfer += $output->writeFieldBegin('orderSn');
			$xfer += $output->writeString($this->orderSn);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->mainTransportNo !== null) {
			
			$xfer += $output->writeFieldBegin('mainTransportNo');
			$xfer += $output->writeString($this->mainTransportNo);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->custCode !== null) {
			
			$xfer += $output->writeFieldBegin('custCode');
			$xfer += $output->writeString($this->custCode);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->warehouse !== null) {
			
			$xfer += $output->writeFieldBegin('warehouse');
			$xfer += $output->writeString($this->warehouse);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->subTransportNoInfo !== null) {
			
			$xfer += $output->writeFieldBegin('subTransportNoInfo');
			
			if (!is_object($this->subTransportNoInfo)) {
				
				throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
			}
			
			$xfer += $this->subTransportNoInfo->write($output);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldStop();
		$xfer += $output->writeStructEnd();
		return $xfer;
	}
	
}

?>